import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import { index } from "./module/index"; // 首页
import { team } from "./module/team"; // 团队
import { user } from "./module/user"; // 用户
import { inform } from "./module/inform"; // 通知中心
import { expense } from "./module/expense"; // 成本与费用
import { landresource } from "./module/landresource"; // 土地资源
import { resource } from "./module/resource"; // 资源管理
import { standard } from "./module/standard"; // 品牌标准
import { digitalbase } from "./module/digitalbase"; // 数字基地
import { maintenance } from "./module/maintenance"; // 平台运维
import { digitalequipment } from "./module/digitalequipment"; // 数字装备
import { productionmanagement } from "./module/productionmanagement"; // 生产管理
import { publicmanagement } from "./module/publicmanagement"; // 公共管理

const routes: Array<RouteRecordRaw> = [
    {
        path: "/login",
        name: "login",
        meta: {
            title: "登录",
            icon: "",
        },
        component: () => import("@/views/entrance/login.vue"),
    },
    {
        path: "/register",
        name: "register",
        meta: {
            title: "注册",
            icon: "",
        },
        component: () => import("@/views/entrance/register.vue"),
    },
    {
        path: "/registered",
        name: "registered",
        meta: {
            title: "注册成功",
            icon: "",
        },
        component: () => import("@/views/entrance/registered.vue"),
    },
    {
        path: "/retrieve",
        name: "retrieve",
        meta: {
            title: "找回密码",
            icon: "",
        },
        component: () => import("@/views/entrance/retrieve.vue"),
    },
    {
        path: "/editormap",
        name: "editormap",
        meta: {
            title: "地图编辑",
            icon: "",
        },
        component: () => import("@/views/editorMap/index.vue"),
    },
    {
        path: "/",
        name: "layout",
        component: () => import("@/layout/index.vue"),
        redirect: "/index",
        children: [index, team, user, standard, inform, expense, landresource, resource, digitalbase, maintenance, digitalequipment, productionmanagement, publicmanagement],
    },
    {
        path: "/:pathMatch(.*)",
        redirect: "/404",
    },
    {
        path: "/404",
        name: "404",
        meta: {
            title: "404",
            icon: "",
        },
        component: () => import("@/views/404.vue"),
    },
];

const router = createRouter({
    // history: createWebHistory(process.env.BASE_URL),
    history: createWebHistory(process.env.BASE_URL),
    routes,
});

export default router;
